GO
/****** Object:  StoredProcedure [dbo].[Delete_GetReceiveDetails]    Script Date: 06/01/2013 11:47:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER OFF
GO
-------------------------------------------------------------------------------
--	METADATA AND OTHER MESSAGES ABOVE.
--	BEGIN CREATE STATEMENTS.
-------------------------------------------------------------------------------

ALTER PROCEDURE [dbo].[GetInventoryDetails]	
	@CompanyID AS INT
	,@Type AS VARCHAR(50)
AS
IF(@Type = 'Receive')
BEGIN
	SELECT 
	T.ID, 
	T.[Description], 
	T.CreatedOn AS ReceivedDate, 
	S.[Address] AS Store,
	T.ReferenceNo AS ReferenceNo
	FROM [Transaction] T
	INNER JOIN Store S ON T.StoreID = S.ID
	WHERE S.CompanyID = @CompanyID
	AND T.IsReceive = 1
END
ELSE
BEGIN
	SELECT 
	T.ID, 
	T.[Description], 
	T.CreatedOn AS ReceivedDate, 
	S.[Address] AS Store,
	T.ReferenceNo AS ReferenceNo
	FROM [Transaction] T
	INNER JOIN Store S ON T.StoreID = S.ID
	WHERE S.CompanyID = @CompanyID
	AND T.IsIssue = 1
END


